package kr.hkit.androidcomplete03;

import kr.hkit.androidcomplete03.ch20.Ch20_AMain;
import kr.hkit.androidcomplete03.ch21.Ch21_AMain;
import kr.hkit.androidcomplete03.ch22.Ch22_AMain;
import kr.hkit.androidcomplete03.ch23.Ch23_AMain;
import kr.hkit.androidcomplete03.ch25.Ch25_AMain;
import kr.hkit.androidcomplete03.ch27.Ch27_AMain;
import kr.hkit.androidcomplete03.ch28.Ch28_AMain;
import kr.hkit.androidcomplete03.ch28_1.Ch28_1_AMain;
import kr.hkit.androidcomplete03.ch29.Ch29_AMain;
import kr.hkit.androidcomplete03.ch30.Ch30_AMain;
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class ActivityMain extends ListActivity {
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(
				this, R.array.chapter, android.R.layout.simple_list_item_1);
		setListAdapter(adapter);
		
	}

	@Override
	protected void onListItemClick(ListView l, View v, int position, long id) {
		Intent intent = null;
		switch (position) {
		case 0:
			intent = new Intent(this, Ch20_AMain.class);
			break;
		case 1:
			intent = new Intent(this, Ch21_AMain.class);
			break;
		case 2:
			intent = new Intent(this, Ch22_AMain.class);
			break;	
		case 3:
			intent = new Intent(this, Ch23_AMain.class);
			break;	
		case 4:
			intent = new Intent(this, Ch25_AMain.class);
			break;	
		case 5:
			intent = new Intent(this, Ch27_AMain.class);
			break;				
		case 6:
			intent = new Intent(this, Ch28_AMain.class);
			break;	
		case 7:
			intent = new Intent(this, Ch28_1_AMain.class);
			break;	
		case 8:
			intent = new Intent(this, Ch29_AMain.class);
			break;		
		case 9:
			intent = new Intent(this, Ch30_AMain.class);
			break;					
		}
		startActivity(intent);
	}

}
